﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for HtmlAttributes
/// </summary>
public class HtmlAttributes
{
    private Dictionary<string, List<string>> attributes;
    public HtmlAttributes()
    {
        attributes = new Dictionary<string, List<string>>();
    }
    public void AddAttribute(string name, string value)
    {
        if (attributes.ContainsKey(name))
        {
            if (attributes[name].Contains(value) == false)
            {
                attributes[name].Add(value);
            }
        }
        else
        {
            attributes.Add(name, new List<string>(new string[] { value }));
        }
    }

    public void RemoveAttribute(string name, string value)
    {
        if (attributes.ContainsKey(name))
        {
            if (attributes[name].Contains(value))
            {
                attributes[name].Remove(value);
                if (attributes[name].Count < 1)
                {
                    attributes.Remove(name);
                }
            }
        }
    }

    public Dictionary<string, List<string>> GetAttributes
    {
        get
        {
            return attributes;
        }
        set
        {
            attributes = value;
        }
    }
}